package jp.co.ricoh.melody.presenters;

import jp.co.ricoh.melody.databases.DBManager;
import jp.co.ricoh.melody.models.AddAlarmActivityModel;
import jp.co.ricoh.melody.models.IAddAlarmActivityModel;
import jp.co.ricoh.melody.models.entities.AlarmData;

/**
 * Copyright (C) 2016 RICOH Co.,LTD.
 * All rights reserved.
 * Implement function add, edit, delete Alarm of Database.
 */
public class AddAlarmActivityPresenter implements IAddAlarmActivityPresenter {

    private IAddAlarmActivityModel mModel = new AddAlarmActivityModel();


    @Override
    public boolean cancelButtonClick(AlarmData oldAlarm, AlarmData newAlarm) {
        return mModel.isAlarmChanged(oldAlarm, newAlarm);
    }

    @Override
    public AlarmData getAlarmById(int id) {
        return mModel.getAlarmById(id);
    }

    @Override
    public void addAlarm(AlarmData alarm, DBManager.OnSaveDataResultListener onSaveDataResultListener) {
        mModel.addAlarm(alarm, onSaveDataResultListener);
    }

    @Override
    public void editAlarm(AlarmData newAlarm, DBManager.OnSaveDataResultListener onSaveDataResultListener) {
        mModel.editAlarm(newAlarm, onSaveDataResultListener);
    }

    @Override
    public boolean validateAlarm(AlarmData alarm) {
        return mModel.validateAlarm(alarm);
    }
}
